package cn.wanho.mapper;

import cn.wanho.dto.ExamSummary;
import cn.wanho.rvo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ExamSummaryMapper {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(ExamSummary record);

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(ExamSummary record);

    /**
     * select by primary key
     * @param id primary key
     * @return object by primary key
     */
    ExamSummary selectByPrimaryKey(Integer id);

    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(ExamSummary record);

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(ExamSummary record);


    /**
     * @author jingxu
     * @date 2022-8-6
     * 将Excel表里的学生答题内容插入数据库的paper_summary表中
     */
    int insertExamSummary(@Param("subjectId") Long subjectId, @Param("studentId") Integer studentId, @Param("answerContent")String answerContent);

    /**
     * @author jingxu
     * @date 2022-8-6
     * 用来查出当前这个提交试卷的学生的选择题成绩
     */
    List<ChooseVO> checkChooseScore(@Param("studentId")Integer studentId);


    /**
     * @author jingxu
     * @date 2022-8-6
     * 填空题分
     */
    List<BlanksVO> checkBlanksScore(@Param("studentId")Integer studentId);

    /**
     * @author jingxu
     * @date 2022-8-6
     * 判断题分
     */
    List<TfVO> checkTfScore(@Param("studentId")Integer studentId);

    /**
     * @author jingxu
     * @date 2022-8-6
     * 将学生的某一个的得分插入数据库中
     */
    int insertSubjectScore(@Param("subjectScore")Integer subjectScore,@Param("studentId")Integer studentId,@Param("subjectId")Long subjectId);

    int updateSubjectGrade(
           @Param("studentId") Integer studentId,
           @Param("subjectId") Long subjectId,
           @Param("score") Integer score);

    List<StudentVO> selectAllStudent(Integer userId);

    List<ScoreAndTeacherVO> queryStudentScore(Integer userId);

    List<ApplyForVO> applyForReconsider(@Param("subjectId") Long subjectId,
                                        @Param("userId") Integer userId);

    int uploadScore(@Param("subjectId") Long subjectId, @Param("studentId") Integer studentId,@Param("score") Integer score);

    // List<PaperRVO> queryPaperAnswer(Integer studentId);

    List<PaperRVO> queryPaperAnswer(Integer studentId);

}